
// ***********************************************************************
// AUTO GENERATED CLASS - Do Not Modify this file, if needed modify .tt
// ***********************************************************************
// Assembly         : InnovaApp_DomainLayer
// Author           : LJO+01
// Created          : 05/07/2013 23:07:47
// ***********************************************************************
// <copyright file="N.A." company="Copyright © Innovacall 2011">
//     Copyright (c) . All rights reserved.
// </copyright>
// <summary>
// Domain layer  
// DomainClass
// </summary>
// ***********************************************************************

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;


namespace InnovaApp.Layers.DomainLayer
{
    /// <summary>
    /// Class ContactAddress
    /// </summary>
    [Serializable]
    public partial class ContactAddress : _DomainLayer_Base
    {
        #region Primitive Properties
    	
        /// <summary>
        /// Gets or sets Id.
        /// </summary>
        /// <value>The Id.</value>
        public virtual int Id
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets Address_1.
        /// </summary>
        /// <value>The Address_1.</value>
        public virtual string Address_1
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets Address_2.
        /// </summary>
        /// <value>The Address_2.</value>
        public virtual string Address_2
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets Address_3.
        /// </summary>
        /// <value>The Address_3.</value>
        public virtual string Address_3
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets ZipCode.
        /// </summary>
        /// <value>The ZipCode.</value>
        public virtual string ZipCode
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets Town.
        /// </summary>
        /// <value>The Town.</value>
        public virtual string Town
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets Cedex.
        /// </summary>
        /// <value>The Cedex.</value>
        public virtual string Cedex
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets Country.
        /// </summary>
        /// <value>The Country.</value>
        public virtual string Country
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets rowversion.
        /// </summary>
        /// <value>The rowversion.</value>
        public virtual byte[] rowversion
        {
            get;
            set;
        }

        #endregion
        #region Navigation Properties
    
        /// <summary>
        /// Link ContactAddress to all Contact__AdressType__ContactAddress
        /// </summary>
        public virtual ICollection<Contact__AdressType__ContactAddress> Contact__AdressType__ContactAddress
        {
            get
            {
                if (_contact__AdressType__ContactAddress == null)
                {
                    var newCollection = new FixupCollection<Contact__AdressType__ContactAddress>();
                    newCollection.CollectionChanged += FixupContact__AdressType__ContactAddress;
                    _contact__AdressType__ContactAddress = newCollection;
                }
                return _contact__AdressType__ContactAddress;
            }
            set
            {
                if (!ReferenceEquals(_contact__AdressType__ContactAddress, value))
                {
                    var previousValue = _contact__AdressType__ContactAddress as FixupCollection<Contact__AdressType__ContactAddress>;
                    if (previousValue != null)
                    {
                        previousValue.CollectionChanged -= FixupContact__AdressType__ContactAddress;
                    }
                    _contact__AdressType__ContactAddress = value;
                    var newValue = value as FixupCollection<Contact__AdressType__ContactAddress>;
                    if (newValue != null)
                    {
                        newValue.CollectionChanged += FixupContact__AdressType__ContactAddress;
                    }
                }
            }
        }
        private ICollection<Contact__AdressType__ContactAddress> _contact__AdressType__ContactAddress;

        #endregion
        #region Association Fixup
    
        private void FixupContact__AdressType__ContactAddress(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.NewItems != null)
            {
                foreach (Contact__AdressType__ContactAddress item in e.NewItems)
                {
                    item.ContactAddress = this;
                }
            }
    
            if (e.OldItems != null)
            {
                foreach (Contact__AdressType__ContactAddress item in e.OldItems)
                {
                    if (ReferenceEquals(item.ContactAddress, this))
                    {
                        item.ContactAddress = null;
                    }
                }
            }
        }

        #endregion
    }
}
